﻿@using ECG.Utility
@using ECG.WebUI.CustomHelpers
@model ECG.Common.ProductCategoryDto
@{
    ViewBag.Title = (string.IsNullOrEmpty(Model.MetaTitle) ? Model.Name : Model.MetaTitle) + ViewBag.strPage;
    ViewBag.Description = (string.IsNullOrEmpty(Model.MetaDescription) ? Model.Name : Model.MetaDescription) + ViewBag.strPage;
    ViewBag.keywords = (string.IsNullOrEmpty(Model.MetaKeyword) ? Model.Name : Model.MetaKeyword) + ViewBag.strPage;
    Layout = "~/Views/Shared/_LayoutHideCate.cshtml";
    var fbFanUrl = ECG.WebUI.CustomHelpers.FunctionHelpers.returnConfig("FacebookFanpageUrl");
    var fbcode = ECG.WebUI.CustomHelpers.FunctionHelpers.returnConfig("FacebookCode");
    var cateMap = (List<ECG.Common.ProductCategoryMapLinkDto>)ViewBag.listCateMapLink;
}
@section headerProperty
{
    <meta property="og:image" content="@Model.ImagePath.ImagePathThumbDefault()" itemprop="thumbnailUrl" />
    <meta property="og:title" content="@Model.Name">
    <meta itemprop="description" property="og:description" content="@Model.MetaDescription">
    <meta property="og:url" content="@Request.Url" />
}
<div class="layout-width">
    @if (cateMap != null && cateMap.Any())
    {
        var cateByTop = from c in cateMap where c.Position == "top" orderby c.Ordering ascending select c;
        if (cateByTop.Any())
        {
            <div class="MapLink">
                <div class="ml-left">
                    <span>Nổi bật: </span>
                    @foreach (var item in cateByTop)
                    {
                        <a href="@item.Url">@item.Name</a>
                    }
                </div>
            </div>
        }
    }
    @Html.Action("Adv1ByCategory", "CategoryL1", new { category = Model.Id, w = 980, o = 0 })
    <div class="cate-page-box clearfix">
        <div class="cate-left-box fl">
            <div class="cate-list">
                @Html.Action("CategoryMenuLeft", "Category", new { categoryId = Model.Id })
            </div>
            @if (cateMap != null && cateMap.Any())
            {
                var cateByLeft = from c in cateMap where c.Position == "left" orderby c.Ordering ascending select c;
                if (cateByLeft.Any())
                {
                    <div class="CateMap_Left">
                        <div style="padding:10px;">
                            <p>
                                <strong>Danh mục liên quan</strong>
                            </p>
                            <p>
                                <ul class="ul">
                                    @foreach (var item in cateByLeft)
                                    {
                                        <li><a href="@item.Url">@item.Name</a></li>
                                    }
                                </ul>

                            </p>
                        </div>
                    </div>
                }
            }
            <div class="cate-adv-left">
                @Html.Action("Adv1ByCategory", "CategoryL1", new { category = Model.Id, w = 182, o = 0 })
            </div>
            <div class="cate-fb-box">
                @if (!string.IsNullOrEmpty(fbFanUrl) && !string.IsNullOrEmpty(fbcode))
                {
                    <div class="fb-like-box" data-href="@fbFanUrl" data-width="180" data-height="330" data-colorscheme="light" data-show-faces="true" data-header="true" data-stream="false" data-show-border="true"></div>
                }

            </div>
        </div>
        <div class="cate-right-box fl">
            <div class="cate-right-top">
                @Html.Action("DirectionCategory", "Category", new { categoryId = Model.Id })
                @Html.Action("PromotionByCate", "CategoryL1", new { categoryId = Model.Id })
            </div>
            <div class="cate-tab-box">
                @Html.Action("ProductCateWithTab", "CategoryL1", new { categoryId = Model.Id })
            </div>
            <div class="cate-right-top">
                @Html.Action("ProductRateByCate", "CategoryL1", new { categoryId = Model.Id })
            </div>
            <div class="provider-cate-box">
                @Html.Action("GetProviderByCate", "CategoryL1", new { categoryId = Model.Id, CateName = Model.Name })
            </div>
            <div class="cate-right-top">
                @Html.Action("CateWithCateOther", "CategoryL1", new { categoryId = Model.Id })
            </div>
        </div>
    </div>
    <div class="right-footer-text">
        <div class="c-f-t-header">
            <a href="javascript:void(0);" rel="nofollow">
                @Model.Summary
            </a>
        </div>
        <div class="c-f-t-content">
            @Html.Raw(Model.Description)
        </div>
    </div>
</div>
@section scripts
{
    @Scripts.Render("~/bundles/categoryProduct")
    @Scripts.Render("~/bundles/flexSlider")
@Styles.Render("~/Content/flexSlider")
    @if (!string.IsNullOrEmpty(fbFanUrl) && !string.IsNullOrEmpty(fbcode))
    {
        @Html.Raw(Server.HtmlDecode(fbcode))
    }
    @*https://developers.facebook.com/docs/plugins/comments/
            <div id="fb-root"></div>
        <script>
            (function (d, s, id) {
                var js, fjs = d.getElementsByTagName(s)[0];
                if (d.getElementById(id)) return;
                js = d.createElement(s); js.id = id;
                js.src = "//connect.facebook.net/vi_VN/all.js#xfbml=1&appId=236490029757493";
                fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk'));
        </script>*@
}